home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
Pascal
/
SWar
/
Stars.p
< prev
next >
Wrap
Text File
|
1995-06-15
|
855b
|
43 lines
unit stars;
interface
uses
{$IFC UNDEFINED THINK_PASCAL}
Types, QuickDraw, Events, Menus, Dialogs, Fonts, Resources, Devices,
{$ENDC}
Globals, Util;
procedure InitStars;
procedure DrawStars;
implementation
procedure InitStars;
var
i: Integer;
begin
for i := 0 to MAX_STARS - 1 do
begin
gStarRecs[i].where.v := RngRnd(0, 479);
gStarRecs[i].where.h := RngRnd(0, 639);
gStarRecs[i].color.red := -1;
gStarRecs[i].color.green := -1;
gStarRecs[i].color.blue := -1;
end; (* for *)
end; (* InitStars() *)
procedure DrawStars;
var
i: Integer;
savePort: GrafPtr;
begin
GetPort(savePort);
SetPort(GrafPtr(gOSPtr));
for i := 0 to MAX_STARS - 1 do
begin
SetCPixel(gStarRecs[i].where.h, gStarRecs[i].where.v, gStarRecs[i].color);
end; (* for *)
SetPort(savePort);
end; (* DrawStars() *)
end.